<template>
  <div class="content">
    <!-- nav模块 -->
    <nav class="navtitle">
      <el-menu :default-active="activeIndex" class="el-menu-demo" mode="horizontal" text-color="#CCCCCC" @select="handleSelect">
        <el-menu-item index="1">全部</el-menu-item>
        <el-menu-item index="2">市场动态</el-menu-item>
        <el-menu-item index="3">媒体报道</el-menu-item>
      </el-menu>
    </nav>
    <div class="neirong">
      <!-- 新闻模块单例开始 -->
      <div class="neirongitem" v-for="item of newsList" :key="item.id">
        <div class="neirongitem_left">
          <img :src="item.cover" alt="" />
        </div>
        <div class="neirongitem_right">
          <div class="neirongitemtitle">
            <span class="newstag">{{ item.type_name }}</span>
            <span>{{ item.title }}</span>
          </div>
          <div class="neirongitemsubtitle">
            {{ item.brief }}
          </div>
          <div class="neirongitembottom">
            <div class="neirongitemshijian">
              {{ item.create_at }}
            </div>
          </div>
        </div>
      </div>
      <!-- 新闻模块单例结束 -->
    </div>
  </div>
</template>
<script>
export default {
  data() {
    return {
      activeIndex: '1',
      newsList: []
    }
  },
  mounted() {
    this.getNewsInfo()
  },
  methods: {
    handleSelect(key) {
      this.activeIndex = key

      this.getNewsInfo(key - 1)
    },
    async getNewsInfo(num) {
      const res = await this.axios.get('/api/bdweb/news', {
        params: {
          type: num
        }
      })

      this.newsList = res.data.data
    }
  }
}
</script>
<style scoped>
.content {
  width: 1920px;
}
.navtitle {
  width: 1920px;
  height: 100px;
  background: #ffffff;
  box-shadow: 0px 0px 5px 0px rgba(204, 204, 204, 0.6);
  padding-left: 212px;
}
.el-menu.el-menu--horizontal {
  border: none;
}
.el-menu {
  padding-top: 20px;
}
.el-menu-item {
  font-size: 26px;
  font-family: Microsoft YaHei;
  font-weight: 400;
  color: #2b2b2b;
  padding: 0 40px;
}
.neirong {
  width: 1530px;
  margin: 70px 175px 93px 210px;
}
.neirongitem {
  margin-bottom: 70px;
  display: flex;
  justify-content: space-between;
}
.neirongitem_left {
  width: 510px;
  height: 280px;
}
.neirongitem_left > img {
  width: 100%;
  height: 100%;
}
.neirongitem_right {
  width: 960px;
  position: relative;
}
.neirongitemtitle {
  display: flex;
}
.neirongitemtitle > .newstag {
  width: 120px;
  height: 44px;
  background: #0594fe;
  border-radius: 5px;
  font-size: 22px;
  font-family: Microsoft YaHei;
  font-weight: 300;
  color: #ffffff;
  line-height: 44px;
  text-align: center;
  margin-right: 14px;
}
.neirongitemtitle > span {
  font-size: 24px;
  font-family: Microsoft YaHei;
  font-weight: 300;
  color: #2b2b2b;
  line-height: 44px;
}
.neirongitemsubtitle {
  margin-top: 25px;

  font-size: 20px;
  font-family: Microsoft YaHei;
  font-weight: 300;
  color: #2b2b2b;
  line-height: 30px;
}
.neirongitembottom {
  position: absolute;
  bottom: 0;
  left: 0;
  display: flex;
}
.tagzhiding {
  width: 100px;
  height: 44px;
  border: 1px solid #0594fe;
  border-radius: 5px;

  font-size: 26px;
  font-family: Microsoft YaHei;
  font-weight: 300;
  color: #0594fe;
  line-height: 44px;
  text-align: center;
  margin-right: 40px;
}
.neirongitemshijian {
  font-size: 24px;
  font-family: Microsoft YaHei;
  font-weight: 300;
  color: #2b2b2b;
  line-height: 44px;
}
</style>
